package com.marry.blog.service;

import com.marry.blog.dao.BlogTypeDao;
import com.marry.blog.entity.BlogType;
import com.marry.blog.entity.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ml
 * @create 2017-07-31--14:10
 */
@Service("blogTypeService")
public class BlogTypeServiceImpl implements BlogTypeService {

    @Autowired
    private BlogTypeDao blogTypeDao;
    @Override
    public PageBean<BlogType> listByPage(PageBean<BlogType> pageBean) {
        pageBean.setResult(blogTypeDao.listByPage(pageBean.getStart(),pageBean.getPageSize()));

        pageBean.setTotal(blogTypeDao.getTotal());

        return  pageBean;
    }

    @Override
    public Integer addBlogType(BlogType blogType) {
        return blogTypeDao.addBlogType(blogType);
    }

    @Override
    public Integer updateBlogType(BlogType blogType) {
        return blogTypeDao.updateBlogType(blogType);
    }

    @Override
    public Integer deleteBlogType(Integer id) {
        return blogTypeDao.deleteBlogType(id);
    }
}
